package com.lp.easymethodlink.ui;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.lp.easymethodlink.model.CallHierarchyNode;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

/**
 * 调用链路展示对话框
 */
public class CallHierarchyDialog extends DialogWrapper {
    
    private CallHierarchyPanel panel;
    
    public CallHierarchyDialog(Project project) {
        super(project);
        panel = new CallHierarchyPanel();
        setTitle("方法调用链路分析");
        init();
    }
    
    @Nullable
    @Override
    protected JComponent createCenterPanel() {
        return panel;
    }
    
    /**
     * 显示调用链路
     * @param rootNode 根节点
     */
    public void displayCallHierarchy(CallHierarchyNode rootNode) {
        panel.displayCallHierarchy(rootNode);
    }
}